#pragma once

#include <unordered_map>
#include "../share/user_define.h"
#include "../../3rd/libjson/json.h"

/*
"star": 5,
"call_stone_num": 330,
"evolve_cost": 800000,
"evolve_stone_num": 150,
"convert_stone_num": 0
*/

struct UpgradeStarConsume
{
	uint32_t mId;
	uint32_t mCallStoneNum;
	uint32_t mEvolveCost;
	uint32_t mEvolveStoneNum;
	uint32_t mConvertStoneNum;

	UpgradeStarConsume()
	{
		Clear();
	}

	void Clear(void)
	{
		mId = 0;
	}
};

class UpgradeStarConsumeCacheData
{
public:

	static void CreateInstance(void);
	static UpgradeStarConsumeCacheData* GetInstance(void);

	~UpgradeStarConsumeCacheData(void);

public:

	bool Initialization(void);

	bool Reload(void);

	UpgradeStarConsume* GetData(uint32_t id);

	bool GetDataJsonString(uint32_t id, Json::Value& _jm);

	uint32_t GetDataCount(void);

private:
	UpgradeStarConsumeCacheData(void);

	void Clear(void);

	void AddData(uint32_t id, Json::Value& jm);


private:

	static UpgradeStarConsumeCacheData* mInstance;

	std::unordered_map<uint32_t, UpgradeStarConsume*> m_mapCacheData;
	uint32_t m_maxCount;

};